I have DXL code that creates a list that needs to be made available in the main Dialog Box (DB) as a pick list. Everything appears to be working except that the code that is to generate this list does not appear to be executed. Question is why. When this list generating code is run separately, it works as expected. High level view of code structure is listed below.
Initialize variables . . Code for other functions . . CODE FOR GENERATING LIST SHOWN BETWEEN THE ASTERISKS (*) ******************** current = folder "/" int cntProj = 0 int intProjLst = 0
Item itemRef for itemRef in current Folder do { // First need to know how many projects exist. if (type(itemRef) == "Project") { cntProj++ } } intProjLst = cntProj
if(cntProj == 0) { // No projects found string lstProjDir [1] lstProjDir [0] = "No Projects found..." } else { string lstProjDir [intProjLst] cntProj = 0 // Resetting counter to start over and store Project names. for itemRef in current Project do { // With # projects known, now will store names into list. if (type(itemRef) == "Project") { lstProjDir [cntProj] = name(itemRef) cntProj++ } } } // End of 'if(cntProj == 0)' statement. . ********************
DB Element definition . . OnApply Function to handle DB selected button . . DB Elements alignment code show DB Box Mike.P.Adams - Mon Feb 16 12:35:16 EST 2015 |
Re: Generating List Prior to showing Dialog Box Hi, Hard to say what the issue is. I wasn't able to get your code to work by itself. The declaration of string 1stProjDir[] should not be inside the if/else statements, it is easier to declare string 1sProjDir[intProjLst] right after setting intProjLst. It will have the right array bounds. Then in the second loop, I had to change current Project to current Folder (just like the first loop). Finally, to put it in a dialog box, I added the following code at the end
It all worked for me. Hope this helps, Greg |
Re: Generating List Prior to showing Dialog Box GregM_dxler - Mon Feb 16 13:17:46 EST 2015 Hi, Hard to say what the issue is. I wasn't able to get your code to work by itself. The declaration of string 1stProjDir[] should not be inside the if/else statements, it is easier to declare string 1sProjDir[intProjLst] right after setting intProjLst. It will have the right array bounds. Then in the second loop, I had to change current Project to current Folder (just like the first loop). Finally, to put it in a dialog box, I added the following code at the end
It all worked for me. Hope this helps, Greg Greg, Thanks again - your revisions work as to what I was initially trying to achieve.
|